package rawwrs.util;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtilSingleton {
	
	private static JPAUtilSingleton instance;
	
	private EntityManagerFactory emf;
	
	private JPAUtilSingleton() {
		System.out.println("Iniciando JPA...");
		
		emf = Persistence.createEntityManagerFactory("DAW2-Proyecto");
	}
	
	public static JPAUtilSingleton getInstance() {
		if (instance == null) {
			instance = new JPAUtilSingleton();
		}
		return instance;
	}

	public EntityManagerFactory getEmf() {
		return emf;
	}

}
